package com.oceansoft.mobile.weixin.entity;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;


/**
 * 公众号配置信息
 */
public class WxToken {
    // 商家id
    private Long mer_id;
    // 固定凭证
    private String token;
    // 获取到的凭证
    private String access_token;
    // 凭证有效时间
    private long expires;

    private String appid;

    private String appsecret;

    private String openid;

    private String st_appid;

    private String st_appsecret;


    public static RowMapper<WxToken> getFullMapp() {
        return new RowMapper<WxToken>() {
            @Override
            public WxToken mapRow(ResultSet rs, int rowNum) throws SQLException {
                WxToken obj = new WxToken();
                obj.setMer_id(rs.getLong("mer_id"));
                obj.setToken(rs.getString("token"));
                obj.setAccess_token(rs.getString("access_token"));
                obj.setExpires(rs.getLong("expires"));
                obj.setAppid(rs.getString("appid"));
                obj.setAppsecret(rs.getString("appsecret"));
                obj.setOpenid(rs.getString("openid"));
                obj.setSt_appid(rs.getString("st_appid"));
                obj.setSt_appsecret(rs.getString("st_appsecret"));
                return obj;
            }
        };
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    public WxToken() {
        super();
    }

    public WxToken(Long mer_id, String token) {
        super();
        this.mer_id = mer_id;
        this.token = token;
    }

    public WxToken(Long mer_id, String token, long expires) {
        super();
        this.mer_id = mer_id;
        this.token = token;
        this.expires = expires;
    }


    public WxToken(Long mer_id, String token, String access_token,
                   long expires) {
        super();
        this.mer_id = mer_id;
        this.token = token;
        this.access_token = access_token;
        this.expires = expires;
    }

    public Long getMer_id() {
        return mer_id;
    }

    public void setMer_id(Long mer_id) {
        this.mer_id = mer_id;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public long getExpires() {
        return expires;
    }

    public void setExpires(long expires) {
        this.expires = expires;
    }

    public String getAppid() {
        return appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }

    public String getAppsecret() {
        return appsecret;
    }

    public void setAppsecret(String appsecret) {
        this.appsecret = appsecret;
    }

    public String getSt_appid() {
        return st_appid;
    }

    public void setSt_appid(String st_appid) {
        this.st_appid = st_appid;
    }

    public String getSt_appsecret() {
        return st_appsecret;
    }

    public void setSt_appsecret(String st_appsecret) {
        this.st_appsecret = st_appsecret;
    }
}
